package com.cloudfun.campusshare.entity;

import com.cloudfun.campusshare.common.constant.WashPointType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.List;

/**
 * @author : zhangyongjie
 * @version : 1.0
 * @createTime : 2020/4/28 17:49
 * @description :
 */
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "wash_point")
public class WashPointEntity extends CreatorPersistenceEntity {
    @Id
    @GenericGenerator(name = "id_uuid", strategy = "uuid")
    @GeneratedValue(generator = "id_uuid")
    @Column(name = "id", unique = true, columnDefinition = ("varchar(40) not null comment '主键uuid'"))
    private String id;

    @Column(name = "name", columnDefinition = ("varchar(64) not null comment '洗衣点名称'"))
    private String name;

    @Column(name = "area", columnDefinition = ("varchar(128) not null comment '地区'"))
    private String area;

    @Column(name = "detail_address", columnDefinition = ("varchar(128) not null comment '具体位置'"))
    private String detailAddress;

    @Column(name = "belong_merchant_name", columnDefinition = ("varchar(64) not null comment '所属商家名称'"))
    private String belongMerchantName;

    @Column(name = "merchant_id", columnDefinition = ("varchar(40) not null comment '商家id'"))
    private String merchantId;

    @Column(name = "service_phone", columnDefinition = ("varchar(32) not null comment '客服电话'"))
    private String servicePhone;

    @Column(name = "longitude", columnDefinition = ("varchar(32) default null comment '经度'"))
    private String longitude;

    @Column(name = "latitude", columnDefinition = ("varchar(32) default null comment '纬度'"))
    private String latitude;

    @OneToMany(cascade = CascadeType.REMOVE, mappedBy = "washPointId")
    @JsonIgnoreProperties(value = "washPointConcretePositionEntities")
    private List<WashPointConcretePositionEntity> washPointConcretePositionEntities;

    @Override
    public String toString() {
        return "WashPointEntity{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", area='" + area + '\'' +
                ", detailAddress='" + detailAddress + '\'' +
                ", belongMerchantName='" + belongMerchantName + '\'' +
                ", merchantId='" + merchantId + '\'' +
                ", servicePhone='" + servicePhone + '\'' +
                '}';
    }
}
